﻿using System;
namespace YanZhiwei.DotNet2.Utilities.Common
{
    /// <summary>
    /// TimeSpan帮助类
    /// </summary>
    public static class TimeSpanHelper
    {
        #region 基于秒的对于TimeSpan操作
        /// <summary>
        /// 基于秒的对于TimeSpan操作
        /// </summary>
        /// <param name="ts">TimeSpan</param>
        /// <param name="seconds">秒</param>
        /// <returns>TimeSpan</returns>
        public static TimeSpan AddSeconds(this TimeSpan ts, int seconds)
        {
            return ts.Add(new TimeSpan(0, 0, seconds));
        }
        #endregion 
        #region 基于分钟的对于TimeSpan操作
        /// <summary>
        /// 基于分钟的对于TimeSpan操作
        /// </summary>
        /// <param name="ts">TimeSpan</param>
        /// <param name="minutes">分钟</param>
        /// <returns>TimeSpan</returns>
        public static TimeSpan AddMinutes(this TimeSpan ts, int minutes)
        {
            return ts.Add(new TimeSpan(0, minutes, 0));
        }
        #endregion 
        #region  基于小时的对于TimeSpan操作
        /// <summary>
        /// 基于小时的对于TimeSpan操作
        /// </summary>
        /// <param name="ts">TimeSpan</param>
        /// <param name="hours">小时</param>
        /// <returns>TimeSpan</returns>
        public static TimeSpan AddHours(this TimeSpan ts, int hours)
        {
            return ts.Add(new TimeSpan(hours, 0, 0));
        }
        #endregion 
    }
}